package com.fengye.security.email;

import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * @author fengyexjtu@126.com
 * @date 2022年05月11日 8:05 PM
 */
@Component
public class UserService {
    public UserDetails getByEmail(String principal) {
        return User.builder()
                .username(principal)
                .password("email_password")
                .passwordEncoder((p) -> p)
                .authorities(AuthorityUtils.commaSeparatedStringToAuthorityList("admin,user")).build();
    }
}
